Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native versions for AllocateFileRange() #2229

Merged
merged 2 commits into from Feb 22, 2013
Merged

Conversation

sipa
Copy link
Member

@sipa sipa commented Jan 27, 2013

Implement native versions of AllocateFileRange() for:

  • Linux: posix_fallocate()
  • Mac OSX: fcntl(..., F_PREALLOCATE, ...)
  • Windows: SetEndOfFile()

This should prevent the double-writing fallback that is used currently.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/f92555255c2d928ce618d383aa5da46bd195ef43 for binaries and test log.

@sipa
Copy link
Member Author

sipa commented Jan 28, 2013

Test plan: either (1) start syncing from scratch or (2) delete the blocks/rev* files and start a -reindex. In both cases, at any point in time, should the filesize of the blk* files be a multiple of 16 MiB and the rev* files a multiple of 1 MiB.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/2d5e0349e19eec9b4c322cdeab37cb0019551fb6 for binaries and test log.

@CodeShark
Copy link
Contributor

The test succeeded under OS X Version 10.8.2

@gmaxwell
Copy link
Contributor

Reindex test passes on Fedora 16/17. Needs windows testing.

@gavinandresen
Copy link
Contributor

This is just an optimization, yes?

I think it can wait for 0.8.1.

@sipa
Copy link
Member Author

sipa commented Jan 28, 2013

Indeed an optimization, but one that is easy to test. Ok for 0.8.1.

@jgarzik
Copy link
Contributor

jgarzik commented Jan 30, 2013

Nit: use #elif

ACK

@sipa
Copy link
Member Author

sipa commented Jan 30, 2013

Added a commit to drop the pre-allocated padding when finalizing a block file (=moving to a next one).

@gmaxwell
Copy link
Contributor

ah, good to not waste 30MiB...

@sipa
Copy link
Member Author

sipa commented Jan 30, 2013

@gmaxwell Largest advantage is the ability to cat the files together to create a bootstrap.dat :)

... though I'm sure people would otherwise complain about wasted disk space too :p

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/1eb578796c98f457546059b66eb98fd0efc8e690 for binaries and test log.

@laanwj
Copy link
Member

laanwj commented Feb 4, 2013

ACK

gavinandresen added a commit that referenced this pull request Feb 22, 2013
Native versions for AllocateFileRange()
@gavinandresen gavinandresen merged commit b8f4e42 into bitcoin:master Feb 22, 2013
@sipa sipa deleted the prealloc branch May 3, 2013 18:50
laudney pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request Mar 19, 2014
Native versions for AllocateFileRange()
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants